//
//  AppDelegate.swift
//  dsdsd
//
//  Created by 生生 on 2018/3/15.
//  Copyright © 2018年 生生. All rights reserved.
//

import UIKit

class GZTtTestModel: Codable {
    var hh : String = ""
    func tes0t(lll:String) -> String {
        return "dsdsd"
    }
}

class GZTAnnouncementModel: Codable {
    var list : String = ""
    var bannerList :Int = 0
    var model: GZTtTestModel = {
        let model = GZTtTestModel.init()
        model.hh = "dsd"
        return model
    }()
    
    func test(lll:String) -> String {
        return "dsdsd"
    }
}

extension Mirror{
    func printMirror(){
        print("mirror:\(self) type:\(self.subjectType) displayStyle \(self.displayStyle) superClassMirror \(self.superclassMirror) ")
        for (key,value) in self.children{
            print("\(key) : \(value)")
        }
    }
}

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
//        var s = {(i:Int) -> Int in  return i + i }
//        let mir = Mirror(reflecting: s)
//        mir.printMirror()
//        typealias item = (key:String,value:AnyObject)
//        let a:item = ("111",222 as AnyObject)
//        let mirty = Mirror(reflecting: a)
//        mirty.printMirror()
//        Mirror(reflecting: "1").printMirror()
//        Mirror(reflecting: 1.1).printMirror()
//        Mirror(reflecting: NSData()).printMirror()
//        Mirror(reflecting: NSNull()).printMirror()
//        enum week:Int{
//            case Mon = 1,Thu,Wed,Tur,Fri,Sat,Sun
//        }
//        Mirror(reflecting: week.Fri).printMirror()
//        
//        
//        let model = GZTAnnouncementModel.init()
//        model.list = "sd"
//        model.bannerList = 32
//        Mirror(reflecting: model).printMirror()

//        var value:(Int,String) = (61,"小明")
//        switch value {
//        case let (x,y) where x < 60:
//            print("不及格")
//        default:
//            print("及格")
//        }
//        let vc = ViewController.init()
//        self.testFun(vc, "sdsd")

        let stringArray = ["Objective-C", "Swift", "HTML", "22", "CSS", "JavaScript"]
        

        let sdd = stringArray.map({ string-> Int in
            return string.count
        })
        
        // 拼接
        let pinjie = stringArray.reduce("", {
            return $1 != "22" ? $0 + $1 : $0
        })

        // 最大值
        var ssdddd = [1,2,545,3,4,5]
        let sdsd = ssdddd.reduce(0, {
            if $0 < $1 {
                return $1
            }
            return $0
        })
            
        return true
    }

    func testFun<T:UIViewController, U>(_ sss:T, _ ddd:U)  {
        print("sss:\(sss)")
        print("sss——type:\(type(of: sss))")
        print("ddd:\(ddd)")
        print("ddd---type:\(type(of: ddd))")
    }
    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }


}

